package com.eims.sls_app.utils;

import android.app.Activity;
import android.content.Context;
import android.text.Spanned;

import com.baidu.frontia.FrontiaApplication;
import com.contans.view.MainFenxiVo;
import com.eims.sls_app.dataaccess.AppObject;
import com.eims.sls_app.dataaccess.DtMatch;
import com.eims.sls_app.dataaccess.DtMatchBJDC;
import com.eims.sls_app.dataaccess.DtMatch_Basketball;
import com.eims.sls_app.dataaccess.Lottery;
import com.eims.sls_app.dataaccess.Schemes;
import com.eims.sls_app.dataaccess.SelectedNumbers;
import com.eims.sls_app.dataaccess.Users;
import com.eims.sls_app.protocol.MD5;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.cache.memory.impl.LRULimitedMemoryCache;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 用来存放所有Activity
 * 
 * @author SLS003
 */
public class App extends FrontiaApplication {
	public static ArrayList<Activity> activityS = new ArrayList<Activity>();
	public static ArrayList<Activity> activityS1 = new ArrayList<Activity>();
	private static Context mContext;
	@Override
	public void onCreate() {
		super.onCreate();



		initImageLoader(getApplicationContext());
		CrashHandler crashHandler = CrashHandler.getInstance();
		// 注册crashHandler
		crashHandler.init(getApplicationContext());
		// 发送以前没发送的报告(可选)
		crashHandler.sendPreviousReportsToServer();
		// Logger.init("eims.sls_app"); // default PRETTYLOGGER or use just
		// init()
		// .setMethodCount(3); // default 2
		// .hideThreadInfo() // default shown
		// .setLogLevel(LogLevel.NONE); // default LogLevel.FULL
	}

	public void initImageLoader(Context context) {
		ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
				context).threadPriority(Thread.NORM_PRIORITY - 2)
				.denyCacheImageMultipleSizesInMemory()
				.memoryCacheExtraOptions(480, 800) //即保存的每个缓存文件的最大长宽  
				.discCacheFileNameGenerator(new Md5FileNameGenerator())
				.tasksProcessingOrder(QueueProcessingType.LIFO)
				.memoryCache(new LRULimitedMemoryCache(40*1024*1024))
				.writeDebugLogs() // Remove for release app
				.build();
		ImageLoader.getInstance().init(config);
	}
	
	public static Context getContext(){
		return mContext;
	}
	
	 public static int footballBfPosition=0; // 方案id
	 public static int baskballBfPosition=0; // 方案id
	
	//比赛详情
	public static MainFenxiVo mainFenxiVo = null;

	public static String LotteryID;
	
	 public static String ballInfoId; // 方案id
	 public static String getInfoNum="0"; 
	 public static int schemeId; // 方案id
	 public static int groupPosition=-1; // 方案id
	 public static int childPosition=-1; // 方案id

	public static boolean choiceNum = false;
	public static String version;
	public static int flag = 0;
	// 用户
	
	public static String imeiReal = "862546034502640";//手机适配号
	public static Users user = null;
	public static Schemes scheme = null;
	public static AppObject appobject = new AppObject();
	public static String[] Imagearray;
	public static long width;
	public static long height;
	public static boolean isShow = true;
	public static String imei = "";
	public static int index = 1; // 第几次进入主界面
	public static final boolean DEBUG = true;
	public  static Spanned  showZongjiangInfo;
	public final static String userid= "306826";
	public final static String MD5_key = "Q56GtyNkop97H334TtyturfgErvvv98a";

	// key值，校验用
	public static String key = MD5.md5(App.MD5_key);
	/** 百度推送的userId */
	public static String push_userId = "";
	/** 百度推送的channelId */
	public static String push_channelId = "";
	/** 百度推送的DeviceType */
	public static String push_DeviceType = "3";
	/** 0为离线 1为在线 */
	public static String Status = "1";
	public static String APP_NAME = "联盈助手";// 软件名称
	public static String SERVICE_PHONE = "4006-854-855";

	public static long totalCount; // 用户所选总注数
	public static List<SelectedNumbers> list_numbers; // 用户所投的集合
	public static Lottery lottery; // 彩种对象
	public static int bei = 1;
	public static int qi; // 追多少期
	public static String type; // 竞彩过关类型
	public static String ball; // 竞彩过关数据---
	public static boolean isCanBet = true; // 高频彩是否能投注
	public static String followCommissionScale = ""; // 合买佣金比列
	public static String followLeastBuyScale = ""; // 合买最少购买比列
	public static List<List<DtMatch>> list_Matchs; // 比赛对阵信息
	public static List<List<DtMatch_Basketball>> DtMatch_Basketball; // 比赛对阵信息
	public static List<List<DtMatchBJDC>> list_Matchs_bjdc; // 比赛对阵信息
	public static List<List<DtMatch>> list_singlepass_Matchs; // 单关比赛对阵信息
	public static List<List<DtMatch_Basketball>> DtMatch_Basketball_single; // 篮球单关比赛对阵信息 
	 //888.qcai888.cn
	//888.qcai888.cn
	public final static String url = "http://888.qcai888.cn/";
	public final static String path = url + "ajax/AppGateway.ashx";
	public final static String Qpath = url + "clientsoft/download.aspx";

	public final static String zPath = url
			+ "Home/Room/OnlinePay/AlipayApp/Trade.aspx";
	public final static String ylPath = url
			+ "Home/Room/OnlinePay/YLAPP/purchase.aspx";
	public final static String server_url = "https://msp.alipay.com/x.htm";
	public final static String web_pay_url = "http://hqcz.ucaipiao.com/index.aspx?user_id=";
	// 请求路径
	public final static String pay_success = "http://hqcz.ucaipiao.com/Pay.aspx?";
	// 获取订单号的路径
	public final static String pay_outer_no = "http://hqcz.ucaipiao.com/Pay2.aspx?";
	// 获取兴业订单号的路径
		public final static String pay_outer_no_xinye = "http://hqcz.ucaipiao.com/Pay5.aspx?";
	// 获取可付订单号的路径
	public final static String pay_outer_no_kefu = "http://hqcz.ucaipiao.com/Pay3.aspx?";
	public final static String pay_outer_no_shenzhen = "http://hqcz.ucaipiao.com/Pay6.aspx?";
	public final static String pay_outer_saoma_shenzhen = "http://hqcz.ucaipiao.com/Pay7.aspx?";
	// 支付同步接口
	//public final static String pay_tongbu = "http://hqcz.ucaipiao.com/PayConfirm2.aspx";
	public final static String pay_tongbu = "http://hqcz.ucaipiao.com/KPayConfirm.aspx";
	
	public final static String PAY_KEFU = "http://extman.kefupay.cn/tradition/WeChatpayment_mobile.action";
	//public final static String pay_tongbu2 = "http://hqcz.ucaipiao.com/KPayConfirm.aspx";
	// 合买人信息
	public final static String AppGateway = url + "ajax/AppGateway.ashx";
	// 实时比分
	public final static String H5_Live = "https://m.sporttery.cn/wap/fb_livescore.html";
	public final static String H5_betfair = "http://m.iuliao.com/odds/betfair";
	public final static String H5_liao = "https://www.sporttery.cn/wap/fb/";
	public final static String H5_odds = "http://m.iuliao.com/odds";

	public static String serverTime = "";
	public static String winToday = "";
	public final static String[] names = { "opt", "auth", "info" };

	// 标准版JC - 29时时彩 "72", "73", "28", "78", "83", "62", "74", "75", "39"
	public final static String lotteryIds = "72, 73, 28, 78, 83, 62, 74, 75, 39, 45";// "83,6,62,70,28,61,5,13,3,39,63,64,78,74,75,72,73,45";
	// 彩种ID 对应 的 图片
	public static Map<String, Integer> allLotteryLogo = null;
	// 彩种ID 对应的 名称
	public static Map<String, String> allLotteryName = null;
	public static String lotterysId = "";// 用于保存所有的彩种位置

	public static long sum_Income_Money = 0; // 总收入
	public static long sum_Expense_Money = 0; // 总支出
	public static long sum_Bonus_Money = 0; // 中奖

	public static boolean isVibrator;
	public static boolean isSensor;
	public static String isPushKJ;
	public static String isPushZJ;

	public static final int BASE_ID = 0;
	public static final int RQF_PAY = BASE_ID + 1;
	public static final String VERSION = "version";
	public static final String partner = "partner";

	public static final String action = "action";
	public static final String actionUpdate = "update";
	public static final String data = "data";
	public static final String platform = "platform";

	public static final int Lottery_ALL = 1; // 个人中心 查看类型 为 全部
	public static final int Lottery_WIN = 2; // 个人中心 查看类型 为 中奖
	public static final int Lottery_WAIT = 3; // 个人中心 查看类型 为 待开奖
	public static final int Lottery_FOLLOW = 4; // 个人中心 查看类型 为 追号
	public static final int Lottery_CHIPPED = 5; // 个人中心 查看类型 为 合买

	public static final int ERROR_SUCCESS = 0;
	public static final int ERROR_UNLONGIN = -100;
	public static final int ERROR_TOTAL = -102;
	public static final int ERROR_MONEY = -134;

	/** 绑定银行信息的类型 **/
	public static final int BANK_TYPE = 1;
	public static final int PROVINCE_TYPE = 2;
	public static final int CITY_TYPE = 3;
	public static final int ZHI_TYPE = 4;
	public static final int QUESTION_TYPE = 5;
	public static final int QUESTION_TYPE2 = 6;
	public static final int MONEY_TYPE = 7;

	public static ArrayList<Integer> level_star_list = null;
	public static ArrayList<Integer> level_medal_list = null;
	public static ArrayList<Integer> level_cup_list = null;
	public static ArrayList<Integer> level_crown_list = null;
	public static int currentScoring;
	public static int totalScoring;
	public static int totalConversionScoring;
	public static int scoringExchangerate;
	public static int optScoringOfSelfBuy;
	
	public static final String privatekey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCwvNG8bNzsFJNksjWcPcEjcaIoWIuIBkLhupKIL9b9Kara/wcBGUhvr0ogOym8yp4oUR02NOymL4rNKopNnGUoqD6CqyEebpWgsBx505OAsvomRPcpZimpDlX8Wp9TiURbDPjYj9hng9WCTvKK804ffIlzbVmBhLBuGVqzQog4VdcenqYtY6yzWR3APDhZ5JVDKWjmWKlPmd+ReNPtdVd1AwfOSZAZUouzTS67cxQeowYFCaheZBbV5nUY6fHVijErxudxvbJa6qprQOMFnbo1zvlTR/tHFq2nE+6g8XRjeEg29xxgNOzRGJZy+IlaYZwLlYJRbJROA8PWVlWJMDVFAgMBAAECggEAN6wC1Tvli2gf1cRdJs49HJEa52Kc8UgnoTtIFSYcrrqFW16iMjJoouWwj96TEykwELscXIrnUKIBMweHcVMmelwk9Lw7Pn7PG0LedXG0MQIv0gY/ZQcNcHdXlpplPccrhRLdADqvjEv24YlE1Yg2v6xXD8kOPMIzYTsTWwxGJJg/fIDyyviiAOs888z5/np5XCo4fqNikq0mSNozdADPzbUITkDCRWnYFd73aUUb2eQhNpBhbBnaxbdsQXb4hHSIxVcM8oHQJX6FYEl/an0+k8C8Qwcae02BxGeK+e4RX3zK4oEbUpMLFFTSxFqcfHCNrODxd21ZtjqsKq7eZuYUAQKBgQDeNey0km8H8mr6/uMklTjtSZ4DXEoZ2tiwjfSb8UZsG4Lzuqgae3IYgHQx+yjXLD5myEBtJcyI/EQS6oSs1WdzONO66KqXaeeRs46izGKXuEnUJxYG3Eb8kdrg7l5nkpq3/GSUOHlIsSoW1gHeqE2WnB9ug2U2SUV8VWlCu+Y5BQKBgQDLnL9xx6el4BC8PPvZ8CqXeVO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+U1ClM8zQbKx3WeCdzwWywlbepwx/HgDGSkk1gsL97TxLyJYmmrSjgfDEOlCnJAymCBtIKHvUvP1M23qop0vEWaG8k2H9r9VxY780VlHoX1vHUBXG9zkuVvd+DurIPG+xJqy5Rn+9CclT1DDjy";
    public static final String key_kefu = "4297f44b13955235245b2497399d7a93";
    
    /**交易类型---------BEGIN*/
    public static final String regesitor = "tb_Regesitor";//注册
    
    public static final String downLoadKeys = "tb_DownLoadKey";//下载
    
    public static final String verify = "tb_verifyInfo";//微信卡认证
    
    public static final String weiXinPay = "tb_WeixinPay";//微信支付
    
    public static final String orderConfirm = "tb_OrderConfirm";//订单状态查询
    
    public static final String changeRate = "xy_ChangeRate";//同步商户签约费率
    
    public static final String alipayVerify = "tb_alipayVerify";//支付宝卡认证
    
    public static final String aliPay = "tb_alipay";//支付宝支付
    
    public static final String zPayment = "zm_Payment";//代付

	// 新增字段
	public static String isSale = "";
	
}
